from datetime import datetime

from sqlalchemy import Column, Integer, String, CHAR, DECIMAL

from app.models.base import Base, db


class report_info(Base):
    __tablename__ = 'report_info'
    id = Column(Integer, primary_key=True, autoincrement=True)
    order_number = Column(String(80), default='')
    title = Column(String(200), nullable=False)
    author = Column(String(100), default='佚名')
    chars_sum = Column(Integer, default=0)
    total_rate = Column(DECIMAL(5, 2), default=0)
    except_author_rate = Column(DECIMAL(5, 2), default=0)
    except_quote_rate = Column(DECIMAL(5, 2), default=0)
    paragraph_count = Column(Integer, default=0)
    sentence_count = Column(Integer, default=0)
    user = Column(Integer, default=0)
    completed = Column(Integer, default=0)
    pay_type = Column(String(20), default='taobao')
    out_trade_no = Column(String(40), default='')

    def keys(self):
        return ['id', 'order_number', 'title', 'author', 'chars_sum', 'total_rate', 'except_author_rate',
                'except_quote_rate', 'paragraph_count', 'sentence_count', 'create_datetime', 'user', 'completed']
